#include "Vector3d.h"



Vector3d::~Vector3d()
{

}


Vector3d::Vector3d(const Vector3d &other)
{
	*this = other;
}


Vector3d& Vector3d::operator=(const Vector3d &other)
{
	if (this == &other)      // Same object?
		return *this;
	x = other.x;
	y = other.y;
	z = other.z;
	return *this;
}



Vector3d& Vector3d::operator+=(const Vector3d &other)
{
	x += other.x;
	y += other.y;
	z += other.z;
	return *this;
}


Vector3d& Vector3d::operator-=(const Vector3d &other)
{
	x -= other.x;
	y -= other.y;
	z -= other.z;
	return *this;
}


Vector3d& Vector3d::operator/=(const Vector3d &other)
{
	x /= other.x;
	y /= other.y;
	z /= other.z;
	return *this;
}


Vector3d& Vector3d::operator*=(const Vector3d &other)
{
	x *= other.x;
	y *= other.y;
	z *= other.z;
	return *this;
}


Vector3d& Vector3d::operator+(const Vector3d &other)
{
	return Vector3d(*this) += other;
}


Vector3d& Vector3d::operator-(const Vector3d &other)
{
	return Vector3d(*this) -= other;
}


Vector3d& Vector3d::operator*(const Vector3d &other)
{
	return Vector3d(*this) *= other;
}


Vector3d& Vector3d::operator/(const Vector3d &other)
{
	return Vector3d(*this) /= other;
}


Vector3d& Vector3d::operator+=(const double &other)
{
	x += other;
	y += other;
	z += other;
	return *this;
}


Vector3d& Vector3d::operator-=(const double &other)
{
	x -= other;
	y -= other;
	z -= other;
	return *this;
}


Vector3d& Vector3d::operator/=(const double &other)
{
	x /= other;
	y /= other;
	z /= other;
	return *this;
}


Vector3d& Vector3d::operator*=(const double &other)
{
	x *= other;
	y *= other;
	z *= other;
	return *this;
}


Vector3d& Vector3d::operator+(const double &other)
{
	return Vector3d(*this) += other;
}


Vector3d& Vector3d::operator-(const double &other)
{
	return Vector3d(*this) -= other;
}


Vector3d& Vector3d::operator*(const double &other)
{
	return Vector3d(*this) *= other;
}


Vector3d& Vector3d::operator/(const double &other)
{
	return Vector3d(*this) /= other;
}


bool Vector3d::operator==(const Vector3d &other)
{
	if(x != other.x) return false;
	if(y != other.y) return false;
	if(z != other.z) return false;
	return true;
}


bool Vector3d::operator!=(const Vector3d &other)
{
	return !(*this == other);
}


std::string Vector3d::print()
{
	std::stringstream oss;
	oss << "[" << x  << "," << y << "," << z << "]";
	return oss.str();
}

